package ua.dogar.sockets;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import ua.dogar.test.Vectors;
import ua.dogar.vectors.Vector;

public class ServerThread extends Thread {
	private Socket clientSocket;

	public ServerThread(Socket clientSocket) {
		this.clientSocket = clientSocket;
	}

	@Override
	public void run()  {
		try {
			Vector vec1;

			while((vec1 =Vectors.inputVector(clientSocket.getInputStream()))!=null){
			Vector vec2 =Vectors.inputVector(clientSocket.getInputStream());
			Vectors.outputVector( Vectors.addVectors(vec1, vec2),clientSocket.getOutputStream()) ;
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
